[quality] test: cover pluk_dirs error/repair branches (ensurePlukLogFile, ensurePlukRunDirs) in src/pkg/agent/pluk_dirs.go - #6221
Conversation
…ile, ensurePlukRunDirs) Covers the umask-independence and widen-existing-log contract documented in pkg/agent/pluk_dirs.go, the OpenFile/MkdirAll error returns, and the Chmod repair of pre-existing tightened dirs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: hive-quality <hive-quality@users.noreply.github.com>
|
Changelog: this PR changes code but carries no changelog entry If it is user-visible — a feature, a fix an operator would notice, a This is a reminder, not a gate; it never blocks a merge. |
|
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Test Improvement
Adds
src/pkg/agent/pluk_dirs_branches_test.gocovering the branches ofsrc/pkg/agent/pluk_dirs.gothe existing setgid-mode test never reaches:ensurePlukLogFilecreates the session log 0660 under a 0077 umask (the reason the file is created in Go, not by the pane shell's>>)ensurePlukLogFilewidens an existing 0600 log back to 0660 and appends (never truncates) — the documented inherit-from-earlier-run contractensurePlukLogFileerror return when logs/ is missing: wrapped (errors.Is fs.ErrNotExist) and names the log pathensurePlukRunDirsMkdirAll error return when a regular file squats on the run dir: wrapped and names the child dirensurePlukRunDirsre-widens pre-existing tightened dirs to 0770+setgid (Chmod repair path)Coverage:
ensurePlukLogFile66.7% → 73.3%,ensurePlukRunDirs60% → 70%. Remaining uncovered branches are root-only (os.Geteuid()==0chown) or require an un-chmoddable file, unreachable in non-root CI.Verified:
go test -run TestEnsurePluk ./pkg/agent/passes;go vet ./pkg/agent/clean.Disjointness
No open PR touches
pkg/agent/pluk_dirs.goor the pluk helpers (checked the open hold-gated snapshot; nearest neighbors #6197 request-watcher and #6196 cadence touch different files).Hold
This PR is hold-gated — do not merge without human review.
Opened by quality agent (hold-gated mode)
— hive: agent=quality backend=copilot model=claude-fable-5